<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 2</title>
<link rel="stylesheet" href="" type="text/css" /><style type="text/css">.aa{}</style>
<script type="text/javascript">
<!--

(function( window, undefined ) {
	var jMin = function(elem) {
		//=================
		// 内部基础函数 Satrt
		//=================
		//判断数据类型
		function isNull(a){    return a === null;}
		function isUndefined(a){    return a === undefined;}
		function isNumber(a){    return typeof a === 'number';}
		function isString(a){    return ('object'==typeof a)&&a.constructor==String;}
		function isBoolean(a){    return typeof a === 'boolean';}
		function isDate(a){ return (typeof a=='object')&&a.constructor==Date; } 
		function isArray(a){    return Object.prototype.toString.apply(a) === '[object Array]';}
		function isFunction(a){    return Object.prototype.toString.call(a) === '[object Function]';}
		function isWindow(o){    return o && typeof o === 'object' && 'setInterval' in o;}
		function isHTMLElement(a){var d = document.createElement("div");try{d.appendChild(a.cloneNode(true));return a.nodeType==1 ? true : false;}catch(e){return a==window || a==document;}}
		

		//扩展getElementsByClassName
		function getElementsByClassName(searchClass, node,tag) { 
	        if(document.getElementsByClassName){ 
	          var nodes =  (node || document).getElementsByClassName(searchClass),result = nodes;
			  if(tag!=undefined){
				  result = [];
				  for(var i=0 ;node = nodes[i++];){
					if(tag !== "*" && node.tagName === tag.toUpperCase()){
					  result.push(node);
					}else{
					  result.push(node);
					}
				  }
			  }
			  return result;
	        }else{ 
	            node = node || document; 
	            tag = tag || "*"; 
	            var classes = searchClass.split(" "), 
	            elements = (tag === "*" && node.all)? node.all : node.getElementsByTagName(tag), 
	            patterns = [], 
	            returnElements = [], 
	            current, 
	            match; 
	            var i = classes.length; 
	            while(--i >= 0){ 
	                patterns.push(new RegExp("(^|\\s)" + classes[i] + "(\\s|$)")); 
	            } 
	            var j = elements.length; 
	            while(--j >= 0){ 
	                current = elements[j]; 
	                match = false; 
	                for(var k=0, kl=patterns.length; k<kl; k++){ 
	                    match = patterns[k].test(current.className); 
	                    if (!match)  break; 
	                } 
	                if (match)  returnElements.push(current);  
	            } 
	            return returnElements; 
	        } 
	    };
		//=================
		// 内部基础函数 End
		//=================
		
		//选择器#ID/.CLASS/TagName
		if(elem!=undefined&&typeof elem=="string"&&elem.length>0){
			if(/^#/g.test(elem)){ return document.getElementById(elem.substr(1,elem.length));}
			else if(/^\./g.test(elem)){ return getElementsByClassName(jMin.trim(elem.replace(/\./g," ")));}
			else if(/^[a-zA-Z]+$/g.test(jMin.trim(elem))){ return document.getElementsByTagName(jMin.trim(elem));}
		}
		
		//扩展传入对象
		if(elem!=undefined&&typeof elem=="object"){
			var oElem = elem;
			if(isString(oElem)) {
				oElem.trim = function () {  return oElem.replace(/^\s+/ig, "").replace(/\s+$/ig, "");};
				
			}
			if(isArray(oElem)) {
				oElem.del=function(n) {  if(n<0)  return oElem; else return oElem.slice(0,n).concat(oElem.slice(n+1,oElem.length));};

			}
			
			if(isDate(oElem)) {
				oElem.fmt=function(fmt) {         
					var o = {         
					"M+" : oElem.getMonth()+1, //月份         
					"d+" : oElem.getDate(), //日         
					"h+" : oElem.getHours()%12 == 0 ? 12 : oElem.getHours()%12, //小时         
					"H+" : oElem.getHours(), //小时         
					"m+" : oElem.getMinutes(), //分         
					"s+" : oElem.getSeconds(), //秒         
					"q+" : Math.floor((oElem.getMonth()+3)/3), //季度         
					"S" : oElem.getMilliseconds() //毫秒         
					};         
					var week = {"0" : "\u65e5", "1" : "\u4e00","2" : "\u4e8c", "3" : "\u4e09","4" : "\u56db","5" : "\u4e94","6" : "\u516d"};         
					
					if(/(y+)/.test(fmt)){         
						fmt=fmt.replace(RegExp.$1, (oElem.getFullYear()+"").substr(4 - RegExp.$1.length));         
					}         
					if(/(E+)/.test(fmt)){         
						fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "\u661f\u671f" : "\u5468") : "")+week[oElem.getDay()+""]);         
					}         
					for(var k in o){         
						if(new RegExp("("+ k +")").test(fmt)){         
							fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));         
						}         
					}         
					return fmt;         
				} 
			}
			
			if(isHTMLElement(oElem)) {
				oElem.insertAfter=function(n){
					if(!!n&&!n.nextSibling&&n.parentNode&&n.parentNode.appendChild)
						n.parentNode.appendChild(oElem);
					else if(!!n&&!!n.nextSibling&&n.parentNode&&n.parentNode.insertBefore) 
						n.parentNode.insertBefore(oElem,n.nextSibling);
				}
				oElem.find=function(str){
					if(/^#/g.test(str)){ return oElem.getElementById(str.substr(1,a.length));}
					else if(/^\./g.test(str)){ return getElementsByClassName(jMin.trim(str).replace(/\./g,""),oElem);}
					else if(/^[a-zA-Z]+$/g.test(jMin.trim(str))){ return oElem.getElementsByTagName(jMin.trim(str));}
				};

				//简单弥合浏览器一些差异
				//if(!(-[1,])){//IE}
				//else{//not IE}
				
				if(oElem.attachEvent&&oElem.addEventListener==undefined){
						oElem.addEventListener=function(type,fn,sign){oElem.attachEvent("on"+type,fn);};
				}
				if(oElem.addEventListener&&oElem.attachEvent==undefined){	
					oElem.attachEvent=function(type,fn){oElem.addEventListener(type.replace(/^on/,""),fn,false);};
				}
				
				(function(){
					var k = {
						"for":"htmlFor",
						"class":"className",
						"readonly":"readOnly",
						"maxlength":"maxLength",
						"cellspacing":"cellSpacing",
						"rowspan":"rowSpan",
						"colspan":"colSpan",
						"tabindex":"tabIndex",
						"usemap":"useMap",
						"frameborder":"frameBorder",

						"htmlFor":"for",
						"className":"class",
						"readOnly":"readonly",
						"maxLength":"maxlength",
						"cellSpacing":"cellspacing",
						"rowSpan":"rowspan",
						"colSpan":"colspan",
						"tabIndex":"tabindex",
						"useMap":"usemap",
						"frameBorder":"frameborder"
					}
					var getAttr,setAttr,delAttr,value;
					oElem.getAttr =function(attr){
						if(attr==undefined) return null;
						attr = attr.toString().replace(/^\s+/ig, "").replace(/\s+$/ig, "");
						if(attr=="") return null;
						value = oElem.getAttribute(attr);
						if(value==null&&k[attr]!==undefined)
						value = oElem.getAttribute(k[attr]);
						return value;
					};
					oElem.setAttr =function(attr,value){
						if(attr===undefined||value===undefined) return ;
						attr = attr.toString().replace(/^\s+/ig, "").replace(/\s+$/ig, "");
						if(attr=="") return ;
						try{oElem.setAttribute(attr,value);}catch(e){if(k[attr]!==undefined){
						try{oElem.setAttribute(k[attr],value);}catch(ee){if(k[k[attr]]!==undefined&&k[k[attr]]!==attr){
						try{oElem.setAttribute(k[k[attr]],value);}catch(eee){}
						}}
						}}
					};
					oElem.delAttr =function(attr,value){
						if(attr===undefined||value===undefined) return ;
						attr = attr.toString().replace(/^\s+/ig, "").replace(/\s+$/ig, "");
						if(attr=="") return ;
						try{oElem.removeAttribute(attr);}catch(e){if(k[attr]!==undefined){
						try{oElem.removeAttribute(k[attr]);}catch(ee){if(k[k[attr]]!==undefined&&k[k[attr]]!==attr){
						try{oElem.removeAttribute(k[k[attr]]);}catch(eee){}
						}}
						}}
					};

				})();
			}
			//下个版本处理float,cssFloat,styleFloat等css兼容问题

			return oElem;
		}
	}
	
	//获取global对象[未测试]
	jMin.global = (function() { return this || (1,eval)('(this)'); }());
	//封装常用操作附加到jMin
	jMin.trim = function (str) {  return str.toString().replace(/^\s+/ig, "").replace(/\s+$/ig, "");};
	jMin.clone = function(oElem){
		var objClone;
		if (oElem.constructor == Object) objClone = new oElem.constructor(); 
		else objClone = new oElem.constructor(oElem.valueOf()); 
		for (var key in oElem)
		{
			if (objClone[key] != oElem[key])
			{ 
				if ( typeof(oElem[key]) == 'object' && !isHTMLElement(oElem[key]))
				{ 
					objClone[key] = jMin.clone(oElem[key]);
				}
				else
				{
					objClone[key] = oElem[key];
				}
			}
		}
		if(oElem.toString) objClone.toString = oElem.toString;
		if(oElem.valueOf) objClone.valueOf = oElem.valueOf;
		return objClone; 
	 } 

	 //获取event对象
	 jMin.getEvent=function(){
		 var e=null; 
		 var func=jMin.getEvent.caller;
		 if(window.event)    {e=window.event;}
		 else {
			 while(func!=null){
				 var arg0=func.arguments[0];
				 if(arg0){
					 if((arg0.constructor==Event || arg0.constructor ==MouseEvent
						|| arg0.constructor==KeyboardEvent)
						||(typeof(arg0)=="object" && arg0.preventDefault
						&& arg0.stopPropagation)){
						e=arg0;
					 }
				 }
				 func=func.caller;
			 }
		 }
		 if(!!e){
				var keyCode = null;
				if(e.keyCode!=undefined) keyCode = e.keyCode;
				if(e.which!=undefined) keyCode = e.which;
				if(e.charCode!=undefined) keyCode = e.charCode;
				
				if(e.keyCode==undefined){e.keyCode=keyCode;}
				if(e.which==undefined){e.which=keyCode;}
				if(e.charCode==undefined){e.charCode=keyCode;}
				var srcElement = e.srcElement||e.target;
				if(e.srcElement==undefined&&srcElement){e.srcElement=srcElement;}
				if(e.target==undefined&&srcElement){e.target=srcElement;}
				var toElement = e.toElement||e.relatedTarget||null;
				if(e.toElement==undefined&&toElement){e.toElement=toElement;}
				var fromElement = e.fromElement||e.relatedTarget||null;
				if(e.fromElement==undefined&&fromElement){e.fromElement=fromElement;}
				if(e.relatedTarget==undefined&&(toElement||fromElement)){e.relatedTarget=fromElement||toElement;}//*/
		 }
		 return e;
	}
	
	//检测页面载入完毕
	var readyJs =[];
	readyJs.running = 0;
	var ready=function(){
			//var _load = arguments.callee;  
			if ( !! document && document.readyState && document.readyState == "complete") {   
				//write ready function here
				readyJs.reverse();
				while(readyJs.length>0)
				{readyJs.running = -1;try{(readyJs.pop())();}catch(e){}}
				readyJs.running = 0;
			}else{readyJs.running=window.setTimeout(function(){ready();},1);}
	}
	jMin.ready=function(fn){
		if(!isFunction(fn)) return;	
		if(readyJs.running>0) {try{window.clearTimeout(readyJs.running);}catch(e){};readyJs.running=0;}//准备运行
		else if(readyJs.running<0){ window.setTimeout(function() {jMin.ready(fn)},1);}//正在运行
		if(readyJs.running===0){ readyJs.push(fn);	ready(fn);}//停止运行
	}

	//=================
	// 动态载入JS&CSS Satrt
	//=================
	jMin.loadjs=function(url, onload) {  
		var _loadJS = arguments.callee;  
		if ( !! document && document.readyState && document.readyState == "complete") {   
			//write ready function here  
			var domscript = document.createElement('script');  
			domscript.src = url;  
			if ( !! onload) {  
				domscript.afterLoad = onload;  
				domscript.onreadystatechange = function() {  
					if (domscript.readyState == "loaded" || domscript.readyState == "complete") {  
						domscript.afterLoad();  
					}  
				}  
				domscript.onload = function() {  
					if ( !! domscript.afterLoad) domscript.afterLoad();  
				}  
			}  
			document.getElementsByTagName('head')[0].appendChild(domscript);  
		} else window.setTimeout(function() {_loadJS(url, onload)},1);  
	}  
	jMin.loadcss=function(url, onload) {  
		var _loadcss = arguments.callee;  
		if ( !! document && document.readyState && document.readyState == "complete") {   
			//write ready function here  
			var html_doc = document.getElementsByTagName('head')[0];  
			var domcss = document.createElement('link');  
			domcss.setAttribute('rel', 'stylesheet');  
			domcss.setAttribute('type', 'text/css');  
			domcss.setAttribute('href', url);  
			document.getElementsByTagName('head')[0].appendChild(domcss);  
			domcss.id = 'dynamiccss' + (new Date).getTime();  
			//Firefox不支持css的onload或onreadystatechange  
			if ( !! onload) {  
				domcss.afterLoad = onload;  
				domcss.onreadystatechange = function() {  
					if (domcss.readyState == "loaded" || domcss.readyState == "complete") {  
						domcss.afterLoad();  
					}  
				}  
			}  
			if (!document.all) {  
				domcss.poll = function() {  
					try {  
						var sheets = document.styleSheets;  
						for (var j = 0, k = sheets.length; j < k; j++) {  
							if (sheets[j].ownerNode.id == domcss.id) {  
								sheets[j].cssRules;  
							}  
						}  
						if ( !! domcss.afterLoad) domcss.afterLoad();  
					} catch(e) {  
						window.setTimeout(domcss.poll, 50);  
					}  
				}  
				window.setTimeout(domcss.poll, 50);  
			}  
		} else window.setTimeout(function() {_loadcss(url, onload)},1);  
	}
	//=================
	// 动态载入JS&CSS End
	//=================

			
	//=================
	// 操作cookie Start
	//=================
	jMin.getcookie=function(name) {  
		var start = document.cookie.indexOf(name + "=");  
		var len = start + name.length + 1;  
		if ((!start) && (name != document.cookie.substring(0, name.length))) {  
			return null;  
		}  
		if (start == -1) return null;  
		var end = document.cookie.indexOf(';', len);  
		if (end == -1) end = document.cookie.length;  
		return unescape(document.cookie.substring(len, end));  
	}  
	jMin.addcookie=jMin.setcookie=function(name, value, expires, path, domain, secure) {  
		var today = new Date();  
		today.setTime(today.getTime());  
		if (expires) { //expires = expires * 1000 * 60 * 60 * 24;  
		}  
		var expires_date = new Date(today.getTime() + (expires));  
		document.cookie = name + '=' + escape(value) + ((expires) ? ';expires=' + expires_date.toGMTString() : '') + //expires.toGMTString()   
		((path) ? ';path=' + path: '') + ((domain) ? ';domain=' + domain: '') + ((secure) ? ';secure': '');  
	}  
	jMin.delcookie=jMin.deletecookie=function(name, path, domain) {  
		if (getcookie(name)) document.cookie = name + '=' + ((path) ? ';path=' + path: '') + ((domain) ? ';domain=' + domain: '') + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';  
	}  
	//=================
	// 操作cookie End
	//=================  

	//=================
	// AJAX Start
	//=================  
	jMin.ajax = function()
	{
		var ajax={};
		ajax.xmlHttp=null;
		ajax.createXMLHttpRequest = function() {
			if (window.ActiveXObject) {
				ajax.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			else if (window.XMLHttpRequest) {
				ajax.xmlHttp = new XMLHttpRequest();
			}
		};
		ajax.doRequestUsingPOST = function(str) {
			ajax.createXMLHttpRequest();
			if (!(/\?$/.test(str))){str += "?";}
			var url = str +"&" + new Date().getTime();
			ajax.xmlHttp.open("POST", url, true);
			ajax.xmlHttp.onreadystatechange = ajax.handleStateChange;
			ajax.xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
			ajax.xmlHttp.send(null);
		};
		ajax.handleStateChange = function() {
			if(ajax.xmlHttp.readyState == 4) {
				if(ajax.xmlHttp.status == 200) {
					ajax.parseResults();
				}
			}
		};
		ajax.parseResults=function() {};
		return ajax;
	}
	//=================
	// AJAX End
	//================= 
	
	window.jMin = jMin;
})(window);




var myajax;
window.onload = function ()
{
	myajax = new jMin.ajax();
	myajax.parseResults=function() {
		document.getElementById("aa").innerHTML = this.xmlHttp.responseText;
	}
	myajax.doRequestUsingPOST("http://127.0.0.1:8018/htll.html?");
	//doRequestUsingPOST("panel_dic.php?word="+word+"&lang=en2ch&action=sug");


        var father = jMin(".father");
        alert(jMin(father[0]).find(".bbb .aaa").length);
		//alert(getElementsByClassName("aaa bbb",father,"span").length);




}



var f = " aaa";
var s = new String("      123");


alert(jMin.trim(f));

jMin(s);
alert(s.trim().length)

function add(){  
    var d = new Date();  
    d1.setTime(d.getTime()+2000*60*60*24);  
    jMin.setcookie("shop_activity","1",d.getTime());  
  
}  
  
function del(){  
    jMin.deletecookie("shop_activity");  
}  
function kk(){

alert(getEvent().srcElement.tagName);
alert(getEvent().target.tagName);
}
//-->
</script>
</head>

<body>
    <div id="father" class="   father  " onclick="kk()">
        <span class="aaa bbb ccc">ccc</span>
        <span class="aaa bbb zzz">zzz</span>
    </div>
        <span class="aaa bbb ccc">ccc</span>
        <span class="aaa bbb zzz">zzz</span>

<div id="aa">



</div>


</body>

</html>
